<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 100px;
        height: 100px;
        background: red;
        position: absolute;
        left: 0px;
        transition: all 2s;
      }
    </style>
  </head>
  <body>
    <div class="box"></div>
  </body>
</html>
<script>
  //触摸事件  移动端事件
  //  1.开始触摸时触发  touchstart
  document.ontouchstart = function () {
    console.log("开始触摸");
  };

  //  2.移动时触发  touchmove
  document.ontouchmove = function () {
    console.log("移动了");
  };

  //  3.触摸结束后触发  touchend
  document.ontouchend = function () {
    console.log("触摸结束");
  };
  var boxEle = document.querySelector(".box");
</script>
